package top.kuxiao.crmserver.mapper;

import org.apache.ibatis.annotations.Select;
import top.kuxiao.crmserver.pojo.Customer;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import top.kuxiao.crmserver.pojo.Report;

import java.util.List;

/**
 * <p>
 * 客户信息管理 Mapper 接口
 * </p>
 *
 * @author xiaozhang
 * @since 2022-01-17
 */
public interface CustomerMapper extends BaseMapper<Customer> {

    @Select("select customer_name as name , sum(orders_amount) as value from " +
            "orders,customer where customer.customer_id=orders.customer_id " +
            "group by orders.customer_id")
    List<Report> getCustomerContribute();


    @Select("select customer_grade as name , count(*) as value from" +
            "customer group by customer_grade")
    List<Report> getCustomerCreditStar();

}
